﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IsmsExplorer.Infrastructure.DomainBase;
using IsmsExplorer.Model.Iso27001;

namespace IsmsExplorer.Model.Documents {
    /// <summary>
    /// Represents all the documents relating to an ISO 27001 Control for a particular project.
    /// </summary>
    public class Iso27001ControlDocumentation : EntityBase {
        private int _projectID;
        private Iso27001Control _isoControl;
        private List<IsmsDocumentLink> _documents = new List<IsmsDocumentLink>();

        public Iso27001ControlDocumentation()
            : base() {
        }

        public Iso27001Control IsoControl {
            get { return _isoControl; }
            set { _isoControl = value; }
        }

        public int ProjectID {
            get { return _projectID; }
            set { _projectID = value; }
        }

        /// <summary>
        /// We are not using the ID property here.
        /// </summary>
        public override int ID {
            get {
                throw new NotImplementedException("Iso27001ControlDocumentation does not Implement the ID property");
            }
            set {
                throw new NotImplementedException("Iso27001ControlDocumentation does not Implement the ID property");
            }
        }

        public IList<IsmsDocumentLink> Documents {
            get { return _documents.AsReadOnly(); }
            //set { _documents = value; }
        }

        public void AddDocument(IsmsDocumentLink doc) {
            // Don't allow duplicate documents in list.
            if (!_documents.Contains(doc)) {
                _documents.Add(doc);
            }
        }

        public void RemoveDocument(IsmsDocumentLink doc) {
            _documents.Remove(doc);
        }

    } // end public class Iso27001ControlDocumentation : EntityBase
}
